home *** CD-ROM | disk | FTP | other *** search
/ Champak 43 / Vol 43.iso / games / superdog.swf / scripts / DefineSprite_876 / frame_2 / DoAction.as
Encoding:
Text File  |  2007-06-25  |  8.6 KB  |  313 lines

  1. function Drow()
  2. {
  3.    if(i % gs == 0)
  4.    {
  5.       _parent.shadows.duplicateMovieClip("rw" + i,i);
  6.       _parent["rw" + i]._x = _X;
  7.       _parent["rw" + i]._y = _Y;
  8.       _parent["rw" + i]._xscale = _xscale;
  9.       _parent["rw" + i].gotoAndStop(_currentframe);
  10.       _parent["rw" + i].ru.gotoAndStop(ru._currentframe);
  11.       _parent["rw" + i].onEnterFrame = function()
  12.       {
  13.          if(_parent.moveL == true and _parent.moveR == false)
  14.          {
  15.             this._x -= _parent.movspd;
  16.          }
  17.          else if(_parent.moveR == true and _parent.moveL == false)
  18.          {
  19.             this._x += _parent.movspd;
  20.          }
  21.          this._alpha -= 10;
  22.          if(this._alpha <= 0)
  23.          {
  24.             this.removeMovieClip();
  25.          }
  26.       };
  27.    }
  28.    i++;
  29. }
  30. stop();
  31. _parent.movlock = false;
  32. this.swapDepths(100000);
  33. gs = 5;
  34. onEnterFrame = function()
  35. {
  36.    if(_parent.pauses == false and _parent.end == false)
  37.    {
  38.       setBrightOffset(_parent.a);
  39.       if(_parent.ability == "speed")
  40.       {
  41.          Drow();
  42.       }
  43.       if(this.behit == true)
  44.       {
  45.          this._alpha = 50;
  46.          this.hit_i = this.hit_i + 1;
  47.          if(this.hit_i >= 45)
  48.          {
  49.             this.hit_i = 0;
  50.             this._alpha = 100;
  51.             behit = false;
  52.          }
  53.       }
  54.       if(_parent.manHp <= 0)
  55.       {
  56.          delete onEnterFrame;
  57.          _parent.movlock = true;
  58.          this.gotoAndPlay("µ¡╗Σ║í");
  59.       }
  60.       var _loc5_ = 0;
  61.       while(_loc5_ < _parent.item_array.length)
  62.       {
  63.          var _loc4_ = _parent.land[_parent.item_array[_loc5_]];
  64.          if(this.hitfk.hitTest(_loc4_))
  65.          {
  66.             delete _loc4_.onEnterFrame;
  67.             _loc4_.play();
  68.          }
  69.          _loc5_ = _loc5_ + 1;
  70.       }
  71.       _loc5_ = 0;
  72.       while(_loc5_ < _parent.enemy_array.length)
  73.       {
  74.          var _loc3_ = _parent.land[_parent.enemy_array[_loc5_]];
  75.          if(zhongquan.hitTest(_loc3_.atkfk))
  76.          {
  77.             if(_loc3_.namess == "boss")
  78.             {
  79.                _loc3_.gotoAndPlay("hit");
  80.             }
  81.             else
  82.             {
  83.                _parent.hiten.start();
  84.                delete _loc3_.onEnterFrame;
  85.                _loc3_.gotoAndPlay("Θçìµï│");
  86.             }
  87.          }
  88.          if(jiguang.hitTest(_loc3_.atkfk) and _loc3_.fired != true)
  89.          {
  90.             if(_loc3_.namess == "boss")
  91.             {
  92.                _loc3_.gotoAndPlay("hit");
  93.             }
  94.             else
  95.             {
  96.                delete _loc3_.onEnterFrame;
  97.                _loc3_.gotoAndPlay("bomb");
  98.             }
  99.          }
  100.          if(xiqi.hitTest(_loc3_.atkfk))
  101.          {
  102.             if(_loc3_.namess != "boss")
  103.             {
  104.                delete _loc3_.onEnterFrame;
  105.                _loc3_.gotoAndPlay("xi");
  106.             }
  107.          }
  108.          if(this.fk.hitTest(_loc3_.fk) and _parent.yinc > 0 and _loc3_.noLife != true and _parent.flyNow == false)
  109.          {
  110.             _parent.yinc = -10;
  111.             _parent.inAir = true;
  112.             if(_loc3_.names != "songshu")
  113.             {
  114.                delete _loc3_.onEnterFrame;
  115.             }
  116.             _loc3_.gotoAndPlay("hit");
  117.          }
  118.          else if(this.hitfk.hitTest(_loc3_.atkfk) and this.behit == false and _parent.manHp > 0)
  119.          {
  120.             _parent.manHp -= 1;
  121.             _parent.hit_s.start();
  122.             _parent.canjump = false;
  123.             this.behit = true;
  124.             breathed = false;
  125.             _parent.movlock = false;
  126.             _parent.yinc = -10;
  127.             _parent.inAir = true;
  128.             if(this._xscale == 100)
  129.             {
  130.                this._x -= 30;
  131.             }
  132.             else
  133.             {
  134.                this._x += 30;
  135.             }
  136.          }
  137.          _loc5_ = _loc5_ + 1;
  138.       }
  139.       if(_parent.movlock == false)
  140.       {
  141.          if(Key.isDown(37))
  142.          {
  143.             prs._xscale = -100;
  144.             this._xscale = -100;
  145.             rDown = false;
  146.             lDown = true;
  147.             if(!_parent.inAir and _parent.flyNow == false)
  148.             {
  149.                if(_parent.spdNow == false)
  150.                {
  151.                   this.gotoAndPlay("Φ╡░");
  152.                }
  153.                else
  154.                {
  155.                   this.gotoAndPlay("σèáΘǃ");
  156.                }
  157.             }
  158.          }
  159.          else
  160.          {
  161.             lDown = false;
  162.          }
  163.          if(Key.isDown(39))
  164.          {
  165.             prs._xscale = 100;
  166.             this._xscale = 100;
  167.             lDown = false;
  168.             rDown = true;
  169.             if(!_parent.inAir and _parent.flyNow == false)
  170.             {
  171.                if(_parent.spdNow == false)
  172.                {
  173.                   this.gotoAndPlay("Φ╡░");
  174.                }
  175.                else
  176.                {
  177.                   this.gotoAndPlay("σèáΘǃ");
  178.                }
  179.             }
  180.          }
  181.          else
  182.          {
  183.             rDown = false;
  184.          }
  185.          if(Key.isDown(40) and !_parent.inAir and _parent.flyNow == false and lDown == false and rDown == false)
  186.          {
  187.             gotoAndStop("Φ╣▓");
  188.          }
  189.          if(!Key.isDown(40) and duck == true)
  190.          {
  191.             gotoAndStop("τ½Ö");
  192.             duck = false;
  193.          }
  194.          if(this.finish == true and _parent.inAir == false)
  195.          {
  196.             this.gotoAndPlay("finish");
  197.          }
  198.          else if(this.finish == true and _parent.flyNow == true)
  199.          {
  200.             _parent.tMax = 0;
  201.          }
  202.          if(Key.isDown(83) and _parent.ability != null and _parent.flyNow == false and _parent.spdNow == false and finish == false)
  203.          {
  204.             prs._visible = false;
  205.             if(_parent.ability == "power")
  206.             {
  207.                _parent.s_hit.start();
  208.                _parent.movlock = true;
  209.                this.gotoAndPlay("Θçìµï│");
  210.             }
  211.             else if(_parent.ability == "breath")
  212.             {
  213.                _parent.movlock = true;
  214.                this.gotoAndPlay("σÉ╕µ░ö");
  215.             }
  216.             else if(_parent.ability == "eye")
  217.             {
  218.                _parent.movlock = true;
  219.                this.gotoAndPlay("µ┐Çσàë");
  220.             }
  221.          }
  222.          if(_parent.ability == "fly" and finish == false and stopFly == false)
  223.          {
  224.             this.gotoAndStop("Θú₧Φíî");
  225.             _parent.flyNow = true;
  226.             _parent.inAir = true;
  227.          }
  228.          if(_parent.ability == "speed" and finish == false)
  229.          {
  230.             _parent.spdNow = true;
  231.             if(inAir == false)
  232.             {
  233.                this.gotoAndStop("σèáΘǃ");
  234.             }
  235.          }
  236.          if(_parent.ability == "fly" and stopFly == true)
  237.          {
  238.             if(_parent.inAir == false)
  239.             {
  240.                prs._visible = true;
  241.                prs._xscale = this._xscale;
  242.             }
  243.             if(Key.isDown(83) and _parent.inAir == false)
  244.             {
  245.                prs._visible = false;
  246.                this.gotoAndStop("Θú₧Φíî");
  247.                _parent.flyNow = true;
  248.                _parent.inAir = true;
  249.                stopFly = false;
  250.             }
  251.          }
  252.          if(_parent.ability == "fly" and _parent.flyNow == true)
  253.          {
  254.             if(Key.isDown(65) and aLock == false)
  255.             {
  256.                _parent.yinc = -15;
  257.                this.gotoAndPlay("Φ╖│");
  258.                _parent.flyNow = false;
  259.                stopFly = true;
  260.             }
  261.             if(Key.isDown(38) and this._y > 80)
  262.             {
  263.                this._y -= 5;
  264.             }
  265.             else if(Key.isDown(40) and this._y < 450)
  266.             {
  267.                dDown = true;
  268.                this._y += 5;
  269.             }
  270.             else if(!Key.isDown(40))
  271.             {
  272.                dDown = false;
  273.             }
  274.          }
  275.          if(Key.isDown(65))
  276.          {
  277.             aLock = true;
  278.          }
  279.          else
  280.          {
  281.             aLock = false;
  282.          }
  283.          if(_parent.ability != "fly")
  284.          {
  285.             dDown = false;
  286.          }
  287.          if(_parent.ability != "fly" and _parent.flyNow == true)
  288.          {
  289.             _parent.flyNow = false;
  290.             this._y -= 10;
  291.             this.gotoAndPlay("Φ╖│");
  292.          }
  293.          if(_parent.ability == "speed" and _parent.spdNow == true)
  294.          {
  295.             _parent.movspd = 10;
  296.          }
  297.          if(_parent.ability != "speed" and _parent.spdNow == true)
  298.          {
  299.             _parent.spdNow = false;
  300.             _parent.movspd = 5;
  301.             this.gotoAndPlay("τ½Ö");
  302.          }
  303.       }
  304.       if(breathed == true and _parent.ability == "breath" and finish == false)
  305.       {
  306.          if(Key.isDown(83))
  307.          {
  308.             this.play();
  309.          }
  310.       }
  311.    }
  312. };
  313.